<div class="row">
<small>
 <div class="span3 bs-docs-sidebar ">
 	<*include file="<*$controller*>/location.tpl"*>
  </div>
  <div class="span9">
   <div class="clearfix txtleft search" style="background-color:#f8f8f8; padding:10px; margin:10px 0px;"> 
      <form action="/<*$controller*>/index/type/<*$type*>" method="get" class="form-horizontal" name="form1">       
		  机构:<select id="jigou" name="groups"  onchange="getSchool(this.value)"></select>
          校园:<select id="school" name="school"  onchange="getClass(this.value)"></select> 
          班级:<select id="class1" name="class" ></select>  <br />
          姓名:<input id="cnname" name="cnname" value="<*$cnname*>" ></input>
          <!-- 电话:<input  id="mobile" name="mobile"  value="<*$mobile*>"></input> -->
         <input type="submit" class="btn btn-success"  value="查询"  >
         <input type="button" class="btn btn-success" value="清空查询" onclick="window.location='/<*$controller*>/<*$action*>/type/<*$type*>'" >
      </form>
	</div>	 
  	<div class="table_content">
		<div class="ta_top"></div>
		<div class="ta_in">
   <*if $result|@count neq 0*>  
   <table cellpadding="0" cellspacing="0" class="table">
		<tr> 
			<th style="width:15%;">所属机构</th>
            <th style="width:18%;">所属校园</th>
			<th style="width:14%;">所属班级</th>
			<th style="width:8%;">姓名</th>
			<th style="width:8%;">昵称</th>
			<th style="width:12%;">生日</th>   
			<th style="width:8%;">性别</th> 
            <th style="width:20%;">类型</th>
			<th>&nbsp;</th>
		</tr>
      
    <*foreach from=$result item=a key =key name=foo*>
		<tr> 
			<td><*$a.groupname*></td>
            <td><*$a.schoolname*></td>
			<td><*$a.classname*></td>
			<td><*$a.cnname*></td>
			<td><*$a.nikename*></td>
			<td><*$a.birthday*></td>
			<td><*if $a.sex eq 1*>男<*else if $a.sex eq 2*>女<*/if*></td> 
            <td><*if $a.viptype eq 1*>试用vip<*else if $a.viptype eq 2*>vip<*else*>普通用户<*/if*></td>
            <td>&nbsp;</td>
		</tr>
		<*/foreach*>
       <tr>
        	<td colspan="8"> <*$page*></td>
            <td>&nbsp;</td>
        </tr>
      <*else*>  
          <tr>
        	<td colspan="8"> 没有您要的结果,请改变你的搜索条件！</td>
            <td>&nbsp;</td>
        </tr> 
        
        <*/if*>
        </table>
        </div>
    <div class="ta_bottom"></div>
	  </div>
     
    </div>
    </small>
</div> 
<script type="text/javascript" src="/js/prototype.js"></script>
<script type="text/javascript">
 
  window.onload=function(){
	 jigou(); 

	if('<*$groups*>' != ''){
		getSchool('<*$groups*>');
	}
	if('<*$school*>' != ''){
		getClass('<*$school*>');
	}

 } 
function jigou()
{  

	var url     = '/<*$controller*>/groups/'; 
	//var pars = '&classname=' + classname +'&name=' + name+'&studentno=' + studentno +'&attend=' + attend + '&leave=' + leave + '&reason=' + reason;
	var pars = '';
	var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars, onComplete:showResponse_course});

} 
function showResponse_course(originalRequest)
{
	{  //alert(originalRequest.responseText);  
		 document.all.form1.groups.innerHTML='<option value="0" >==请选择==</option>'+originalRequest.responseText;
		  if('<*$groups*>' != ''){
			 jsSelectIsExitItem(document.all.form1.groups,'<*$groups*>');
	        } 
	 }

}  

function getSchool(a)
{  
	var url  = '/<*$controller*>/schoollist/'; 
	//var pars = '&classname=' + classname +'&name=' + name+'&studentno=' + studentno +'&attend=' + attend + '&leave=' + leave + '&reason=' + reason;
	var pars = '&id=' + a;
	var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars, onComplete:showResponse_school});

} 
function showResponse_school(originalRequest)
{
	{    //alert(originalRequest.responseText);  
		 document.all.form1.school.innerHTML='<option value="0" >==请选择==</option>'+originalRequest.responseText;
		  if('<*$school*>' != ''){
				jsSelectIsExitItem(document.all.form1.school,'<*$school*>');
			}
	 } 
}  
function getClass(a)
{  
     
	var url  = '/<*$controller*>/classlist/'; 
	//var pars = '&classname=' + classname +'&name=' + name+'&studentno=' + studentno +'&attend=' + attend + '&leave=' + leave + '&reason=' + reason;
	var pars = '&id=' + a;
	var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars, onComplete:showResponse_class});

} 
function showResponse_class(originalRequest)
{
	{    //alert(originalRequest.responseText);  
		 document.all.form1.class.innerHTML='<option value="0" >==请选择==</option>'+originalRequest.responseText;
		  if('<*$classid*>' != ''){
				jsSelectIsExitItem(document.all.form1.class,'<*$classid*>');
			}
	 } 
}  

function deleteit(id,type)
{
  if(confirm("删除将不能恢复")){
   window.location='/<*$controller*>/delete/id/'+id+'/type/'+type;
   }
}

function editit(id,pageNum)
{ 
 	window.location='/<*$controller*>/editstudent/id/'+id+'/pageNum/'+pageNum;
}
 
 function jsSelectIsExitItem(objSelect, objItemValue) {
	//alert(objSelect.options.length);
    for (var i = 0; i < objSelect.options.length; i++) {
        if (objSelect.options[i].value == objItemValue) { 
			objSelect.options[i].selected=true;
        	 break;
        }
    }
    return 1;
}  
 
</script>
